package Test.day16.test;

import day13.exercise.Product;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.List;

public class ProductDaoImpl implements IProductDao {
    public  static  final String PATH="";

    @Override
    public List<Product> findAll() {
        ObjectInputStream in=null;
        List<Product> products=null;
        try {
        in=new ObjectInputStream(new FileInputStream(PATH));

            products= (List<Product>) in.readObject();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }finally {
            if(null!=in){
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }

        return products;
    }

    @Override
    public void save(Product product) {

    }

    @Override
    public void saveList(List<Product> products) {

    }

    @Override
    public void delByrand(String brand) {

    }
}
